
var listElement = Array(), listAux = Array(), cont = 0, contAux = 0, contList = 0, prevElement = null,
        scrollTop = 0, scrollLeft = 0, checkPC = true, imgActual = 'zurichLake', scrollListener = false, elementAux = null, parseListener = true;


$(window).scroll(function() {

    scrollTop = $(window).scrollTop();

    scrollLeft = $(window).scrollLeft();

    if (scrollTop < 1330 && imgActual !== 'zurichLake') {

        showImg(document.getElementById('zurichLake'), document.getElementById(imgActual));

        imgActual = 'zurichLake';
    }
    else if (scrollTop >= 1330 && scrollTop < 4000 && imgActual !== 'zurichEth') {

        showImg(document.getElementById('zurichEth'), document.getElementById(imgActual));

        imgActual = 'zurichEth';
    }
    else if (scrollTop >= 4000 && imgActual !== 'zurichHistory') {

        showImg(document.getElementById('zurichHistory'), document.getElementById(imgActual));

        imgActual = 'zurichHistory';
    }
    scrollListener = true;

    parseListener = true;

});
function showImg(imgToShow, imgToHide) {

    $(imgToHide).fadeOut();

    $(imgToShow).fadeIn();


}
function parse() {

    resetAll();

    $("body").children().each(function(i, element) {

        if ($(this).css('position') === 'fixed') {

            $(this).contents().filter(function(){
                
                return ( $(this).css('position') !== 'fixed' );
            }).addClass('globisFixed');
        }

        if (($(this).height() || $(this).width()) && !(this.tagName === "SCRIPT" || this.tagName === "STYLE" || $(this).css('display') === 'none')) {

            if ($(this).children().toArray().length) {

                $(this).find('*').each(function(i) {
                    if ($(this).css('position') === 'fixed') {
 
                        $(this).contents().filter(function(){
                            
                            return ( $(this).css('position') !== 'fixed' && !$(this).hasClass('globisFixed') );
                        }).addClass('globisFixed');
                    }
                    if (($(this).height() || $(this).width()) && !(this.tagName === "SCRIPT" || this.tagName === "STYLE")) // Validar todas las etiquetas que no son contenido html
                        if (objPos = elementPos(this)) {

                            listAux[contAux++] = objPos;
                        }

                });
                if (listAux.length) {

                    listAux = listAux.reverse();

                    if (objPos = elementPos(this))
                        listAux[contAux] = objPos;

                    for (var i = 0; i < listAux.length; i++) {

                        listElement[contList++] = listAux[i];


                    }
                    listAux = Array();

                    contAux = 0;
                }
            }
            else if (objPos = elementPos(this)) {

                listElement[contList++] = objPos;
            }

        }

    });
}

function resetAll() {

    listElement = Array(), listAux = Array(), cont = 0, contAux = 0, contList = 0, prevElement = null,
            registerType = "register-iframe1", elementAux = null;
}
